<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${basePath}">
<jsp:include page="../header.jsp">
	<jsp:param value="已交完界面" name="title"/>
</jsp:include>
<link href="static/css/teacher.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function addPayment(studentId,studentAllotId) {
		if($(".ui.checkbox").is(':checked')){
		var stuid=$(".studentid");
		var allotid=$(".studentallotid");
		var ifloan=$(".ifloan");
		ifloan.val(1);
		stuid.val(studentId);
		allotid.val(studentAllotId);
		var addpayment=$("#addpaymenterloan")
		addpayment.modal('show'); 
		}else{
			var stuid=$(".studentid");
			var allotid=$(".studentallotid");
			var ifloan=$(".ifloan");
			ifloan.val(0);
			stuid.val(studentId);
			allotid.val(studentAllotId);
			var addpayment=$("#addpaymenternoloan")
			addpayment.modal('show'); 
		}
	}
</script>
</head>
<body>
	<div class = "gps">
		<a class = "home" href="staff?method=forward">首页</a>
		<sapn>></sapn>	
		<a href="total">收款管理</a>
		<sapn>></sapn>	
		<a href="addpaymenter">新增</a>
	</div>
	<div style="padding-bottom: 25px;padding-left: 25px;padding-right: 25px;padding-top: 15px;">
		<table class="ui table">
			<thead>
				<tr>
					<th colspan="8">收款统计表</th>
				</tr>
			</thead>
			<tbody align="center">
				<tr>
					<td colspan="8">
						<div class="searcherstudent">
								<div class="ui form">
									<div class="fields">
										<div class="field">
											<a class="mini ui green label" href="total">未交完</a>
										</div>
										<div class="field">
											<a class="mini ui green label" href="allpayed?allpayed=getallpayed">已交完</a>
										</div>
										<!-- <div class="field">
											<a class="mini ui green label" href="addpaymenter"><i class="icon add"></i>新增</a>
										</div> -->
										<form>
											<div class="fields" style="margin-left: 946px">
												<div class="ui disabled icon input" style="height:28px;width:160px;">
													<i class="search icon"></i>
													<input type="text" name="studentName" value="${param.studentName }" placeholder="检索学员">
												</div>
												<div class="field">
													<button class="mini ui green label">检索</button>
												</div>
											</div>
										</form>
									</div> 
								</div>
						</div>
					</td>
				</tr>
				<tr>
					<td >学员姓名</td>
					<td >性别</td>
					<td >电话</td>
					<td >咨询师</td>
					<td >是否贷款</td>
					<td>&nbsp;</td>
				</tr>
				<c:choose>
					<c:when test="${!empty studentList}">
						<c:forEach items="${studentList}" var="studentList">
								<tr>
									<td >${studentList.studentName}</td>
									<c:choose>
										<c:when test="${studentList.studentSex eq 1}">
											<td >男</td>
										</c:when>
										<c:otherwise>
											<td >女</td>
										</c:otherwise>
									</c:choose>
									<td >${studentList.studentPhone}</td>
									<td >${studentList.studentStaffName}</td>
									<td>
										<input type="checkbox" id="ifloan" class="ui checkbox">
									</td>
									<c:set var="test" value=""></c:set>
									<td >
										<a class="mini ui green label" href="javascript:addPayment(${studentList.studentId},${studentList.studentAllotId});">添加</a>
		<%-- 								<a class="mini ui green label" href="addpaymenter?studentId=${studentList.studentId}&staffId=${studentList.studentAllotId}">添加</a> --%>
									</td>
								</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr>
							<td colspan="8">查无此学生</td>
						</tr>
					</c:otherwise>
				</c:choose>
			</tbody>
		<c:if test="${totalPage > 1}">
			<tfoot>
				<tr>
					<th colspan="7">
						<div class="page">
							<a <c:if test="${page!=1}">href="addpaymenter?page=1${queryString}"</c:if>
								class="${page == 1?'disable':''}">首页</a> <a
								<c:if test="${page!=1}">href="addpaymenter?page=${page-1}${queryString}"</c:if>
								class="${page == 1?'disable':''}">上一页</a> <a
								<c:if test="${page!=totalPage}">href="addpaymenter?page=${page+1 }${queryString}"</c:if>
								class="${page == totalPage?'disable':''}">下一页</a> <a
								<c:if test="${page!=totalPage}">href="addpaymenter?page=${totalPage }${queryString}"</c:if>
								class="${page == totalPage?'disable':''}">尾页</a> <span>
								${page}/${ totalPage} </span>
						</div>
					</th>
				</tr>
			</tfoot>
		</c:if>
		</table>
	</div>
	<div class="ui modal" id="addpaymenterloan" align="center">
	  	<div class="header">添加学员支付</div>
	  	<div class="content">
			<form method="post" action="addpaymenter">
		  		<input type="hidden" name="studentids" class="studentid">
		  		<input type="hidden" name="studentallotids" class="studentallotid">
		  		<input type="hidden" name="ifloans" class="ifloan">
				<p><span style="margin-right: 66px;">输入学期:</span><input type="text" name="totalTerm" placeholder="学期"></p>
				<p><span style="margin-right: 30px;">输入应付金额:</span><input type="text" name="totalMoney" placeholder="应付金额"></p>
				<p><span style="margin-right: 30px;margin-top: 10px;">输入贷款金额:</span><input type="text" name="loanMoney" placeholder="贷款金额" onkeyup="value=value.replace(/[^(\d)]/g,'')"></p>
		  		<div class="actions" id="myaction">
				<div class="mini ui red deny button">取消</div>
				<button class="mini ui green approve button">确认</button>
		  		</div> 
			</form>
	  	</div>
	</div> 
<div class="ui modal" id="addpaymenternoloan">
  	<div class="header">添加学员支付</div>
  	<div class="content">
  		<form method="post" action="addpaymenter">
  			<input type="hidden" name="studentids" class="studentid">
	  		<input type="hidden" name="studentallotids" class="studentallotid">
	  		<input type="hidden" name="ifloans" class="ifloan">
	  		<p><span style="margin-right: 66px;">输入学期:</span><input type="text" name="totalTerm" placeholder="学期"></p>
			<p><span style="margin-right: 30px;">输入应付金额:</span><input type="text" name="totalMoney" placeholder="应付金额" onkeyup="value=value.replace(/[^(\d)]/g,'')"></p>
  			<div class="actions" id="myaction">
			<div class="mini ui red deny button">取消</div>
			<button class="mini ui green button">确认</button>
  			</div> 
  		</form>
  	</div>
</div>
</body>
</html>